Ext.define('DragonApp.view.channel.ChannelForm', {
    extend: 'Ext.window.Window',
    alias: 'widget.channel_form',

    layout: 'center',

    bind: {
        title: '{title}'
    },
    reference: 'channel_window',
    closable: false,
    modal: true,

    items: [{
        xtype: 'form',
        reference: 'form',
        padding: 10,
        modelValidation: true,
        reference: 'channel_form',
        layout: {
            type: 'fit',
            align: 'stretch'
        },
        items: [{
            xtype: 'fieldset',
            width: 380,
            title: '渠道信息',
            layout: 'anchor',
            padding: '15 20 15 20',
            defaults: {
                afterLabelTextTpl: DragonApp.util.String.required,
                anchor: '100%',
                xtype: 'textfield',
                msgTarget: 'side',
                labelWidth: 75
            },
            items: [{
                    xtype: 'hiddenfield',
                    name: 'id',
                    fieldLabel: 'Label'
                },
                {
                    fieldLabel: '渠道编号',
                    name: 'cid'
                },
                {
                    fieldLabel: '渠道名称',
                    name: 'cname'
                },
                {
                    xtype: 'combo',
                    fieldLabel: '是否激活',
                    displayField: 'name',
                    valueField: 'id',
                    queryMode: 'local',
                    forceSelection: true,
                    editable: false,
                    name: 'status',
                    emptyText: '请选择',
                    store: Ext.create('Ext.data.Store', {
                        fields: ['id', 'role_name'],
                        data: [
                            { 'id': 0, 'name': '否' },
                            { 'id': 1, 'name': '是' }
                        ]
                    })
                },
                {
                    fieldLabel: '备注',
                    name: 'comments'
                }
            ]
        }]
    }],
    dockedItems: [{
        xtype: 'toolbar',
        dock: 'bottom',
        ui: 'footer',
        layout: {
            pack: 'end',
            type: 'hbox'
        },
        items: [{
            xtype: 'button',
            text: '保存',
            iconCls: 'x-fa fa-check',
            listeners: {
                click: 'onSave'
            }
        }, {
            xtype: 'button',
            text: '取消',
            iconCls: 'x-fa fa-times',
            listeners: {
                click: 'onCancel'
            }
        }]
    }]
});